//
//  ViewController.m
//  04-HomeWork
//
//  Created by dllo on 16/7/19.
//  Copyright © 2016年 DM.C. All rights reserved.
//

#import "ViewController.h"
#import "Button_image.h"
@interface ViewController ()
@property (nonatomic, strong) UIImageView *backGroundImage;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self createBackGround];
    [self createImageButton];
    [self createCircleImage];
    [self createLabelAndPageControl];
    [self createSlider];
    [self createPlayImageView];
    [self createDownImage];
    [self createButton];
}
#pragma mark - 创建背景图片和label和view
- (void)createBackGround {
    // 创建背景
    self.backGroundImage = [[UIImageView alloc] initWithFrame:[UIScreen mainScreen].bounds];
    _backGroundImage.image = [UIImage imageNamed:@"profile_homepage_default_bg"];
    [self.view addSubview:_backGroundImage];
    UIView *view = [[UIView alloc] initWithFrame:[UIScreen mainScreen].bounds];
    view.backgroundColor = [UIColor colorWithRed:0.39 green:0.36 blue:0.32 alpha:0.8];
    [_backGroundImage addSubview:view];
    // 创建label
    UILabel *labelSong = [[UILabel alloc] initWithFrame:CGRectMake(175, 30, 60, 50)];
    UILabel *labelSinger = [[UILabel alloc] initWithFrame:CGRectMake(172, 85, 70, 40)];
    labelSong.text = @"稻香";
    labelSinger.text = @"周杰伦";
    labelSong.textColor = [UIColor whiteColor];
    labelSinger.textColor = [UIColor whiteColor];
    labelSong.font = [UIFont systemFontOfSize:30];
    labelSinger.font = [UIFont systemFontOfSize:22];
    [self.view addSubview:labelSinger];
    [self.view addSubview:labelSong];
    // 创建线view
    UIView *viewLineLeft = [[UIView alloc] initWithFrame:CGRectMake(135, 105, 25, 1)];
    UIView *viewLineRight = [[UIView alloc] initWithFrame:CGRectMake(255, 105, 25, 1)];
    viewLineLeft.backgroundColor = [UIColor whiteColor];
    viewLineRight.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:viewLineLeft];
    [self.view addSubview:viewLineRight];
}
#pragma mark - 创建标题栏那些button
- (void)createImageButton {
    Button_image *normButton = [Button_image buttonWithType:UIButtonTypeSystem];
    Button_image *exclusiveButton = [Button_image buttonWithType:UIButtonTypeSystem];
    Button_image *MVButton = [Button_image buttonWithType:UIButtonTypeSystem];
    Button_image *dtsButton = [Button_image buttonWithType:UIButtonTypeSystem];
    
    normButton.frame = CGRectMake(60, 140, 80, 30);
    exclusiveButton.frame = CGRectMake(150, 140, 60, 30);
    MVButton.frame = CGRectMake(220, 140, 60, 30);
    dtsButton.frame = CGRectMake(290, 140, 60, 30);
    
    [normButton setImage:[[UIImage imageNamed:@"player_btn_bz_sel_normal"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateNormal];
    [exclusiveButton setImage:[[UIImage imageNamed:@"player_btn_copyright_normal"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateNormal];
    [MVButton setImage:[[UIImage imageNamed:@"player_btn_mv_normal"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateNormal];
    [dtsButton setImage:[[UIImage imageNamed:@"player_btn_dts_on"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateNormal];
    [self.view addSubview:normButton];
    [self.view addSubview:exclusiveButton];
    [self.view addSubview:MVButton];
    [self.view addSubview:dtsButton];
}
#pragma mark - 创建中间圆图片
- (void)createCircleImage {
    // 创建底层图片
    UIImageView *circleImage = [[UIImageView alloc] initWithFrame:CGRectMake(67, 200, 280, 280)];
    circleImage.layer.cornerRadius = 140;
    circleImage.image = [UIImage imageNamed:@"player_icon_mvPreview"];
    circleImage.layer.masksToBounds = YES;
    [self.view addSubview:circleImage];
    // 创建中间图片
    UIImageView *middleImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"text_style_chs_10"]];
    [self.view addSubview:middleImage];
    middleImage.frame = CGRectMake(67, 200, 260, 260);
    middleImage.layer.cornerRadius = 130;
    middleImage.center = circleImage.center;
    middleImage.layer.masksToBounds = YES;

}
#pragma mark - 创建图片下的label和pagecontrol
- (void)createLabelAndPageControl {
    // 创建label
    UILabel *labelSoneName = [[UILabel alloc] initWithFrame:CGRectMake(155, 480, 120, 50)];
    [self.view addSubview:labelSoneName];
    labelSoneName.text = @"曲: 周杰伦";
    labelSoneName.textColor = [UIColor whiteColor];
    labelSoneName.font = [UIFont systemFontOfSize:22];
    // 创建pageControl
    UIPageControl *pageControl = [[UIPageControl alloc] initWithFrame:CGRectMake(168, 536, 80, 10)];
    [self.view addSubview:pageControl];
    pageControl.currentPageIndicatorTintColor = [UIColor whiteColor];
    pageControl.numberOfPages = 3;
}
#pragma mark - 创建slider
- (void)createSlider {
    // 创建slider
    UISlider *slider = [[UISlider alloc] initWithFrame:CGRectMake(60, 560, 294, 20)];
    [slider setMinimumTrackImage:[UIImage imageNamed:@"player_slider_playback_left"] forState:UIControlStateNormal];
    [slider setThumbImage:[UIImage imageNamed:@"player_slider_playback_thumb"] forState:UIControlStateNormal];
    [self.view addSubview:slider];
    //创建左边的label
    UILabel *leftLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 560, 50, 20)];
    [self.view addSubview:leftLabel];
    leftLabel.textColor = [UIColor whiteColor];
    leftLabel.text = @"00:13";
    //创建右边的label
    UILabel *rightLabel = [[UILabel alloc] initWithFrame:CGRectMake(360, 560, 50, 20)];
    [self.view addSubview:rightLabel];
    rightLabel.textColor = [UIColor whiteColor];
    rightLabel.text = @"03:13";

}
#pragma mark - 创建播放的button
- (void)createPlayImageView {
    Button_image *leftButton = [Button_image buttonWithType:UIButtonTypeSystem];
    Button_image *middleButton = [Button_image buttonWithType:UIButtonTypeSystem];
    Button_image *rightButton = [Button_image buttonWithType:UIButtonTypeSystem];
    
    leftButton.frame = CGRectMake(60, 590, 90, 90);
    middleButton.frame = CGRectMake(160, 590, 90, 90);
    rightButton.frame = CGRectMake(265, 590, 90, 90);
    
    [leftButton setImage:[UIImage imageNamed:@"hp_player_btn_pre_normal"] forState:UIControlStateNormal];
    [middleButton setImage:[UIImage imageNamed:@"player_btn_pause_normal"] forState:UIControlStateNormal];
    [rightButton setImage:[UIImage imageNamed:@"hp_player_btn_next_normal"] forState:UIControlStateNormal];
    
    [self.view addSubview:leftButton];
    [self.view addSubview:rightButton];
    [self.view addSubview:middleButton];
}
#pragma mark - 创建提示图片
- (void)createDownImage {
    UIImageView *heartImage = [[UIImageView alloc] initWithFrame:CGRectMake(10, 665, 80, 80)];
    heartImage.image = [UIImage imageNamed:@"mini_love"];
    [self.view addSubview:heartImage];
    
    UIImageView *cycleImage = [[UIImageView alloc] initWithFrame:CGRectMake(90, 665, 80, 80)];
    cycleImage.image = [UIImage imageNamed:@"mini_love"];
    [self.view addSubview:cycleImage];
    
    UIImageView *downloadeImage = [[UIImageView alloc] initWithFrame:CGRectMake(170, 665, 80, 80)];
    downloadeImage.image = [UIImage imageNamed:@"mini_love"];
    [self.view addSubview:downloadeImage];
    
    UIImageView *saveImage = [[UIImageView alloc] initWithFrame:CGRectMake(250, 665, 80, 80)];
    saveImage.image = [UIImage imageNamed:@"mini_love"];
    [self.view addSubview:saveImage];
    
    UIImageView *collectImage = [[UIImageView alloc] initWithFrame:CGRectMake(330, 665, 80, 80)];
    collectImage.image = [UIImage imageNamed:@"mini_love"];
    [self.view addSubview:collectImage];
    
}
#pragma mark - 创建下拉按钮和点点点按钮
- (void)createButton {
    // 创建下拉的button
    Button_image *pullButton = [Button_image buttonWithType:UIButtonTypeSystem];
    pullButton.frame = CGRectMake(20, 30, 50, 50);
    [pullButton setImage:[UIImage imageNamed:@"miniplayer_btn_playlist_close"] forState:UIControlStateNormal];
    pullButton.tintColor= [UIColor whiteColor];
    [self.view addSubview:pullButton];
    // 创建点点button
    Button_image *pointButton = [Button_image buttonWithType:UIButtonTypeSystem];
    pointButton.frame = CGRectMake(340, 34, 40, 40);
    [pointButton setImage:[UIImage imageNamed:@"dlna_more_devices"] forState:UIControlStateNormal];
    pointButton.tintColor= [UIColor whiteColor];
    [self.view addSubview:pointButton];
    

}
















- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
